<?php

//首页
Route::get('/', 'HomeController@index');

//下拉加载
Route::post('scroll', 'HomeController@scroll');

//搜索
Route::get('/search', 'ProductController@search');

//商品
Route::group(['prefix' => 'product'], function () {
    //分类
    Route::get('category', 'ProductController@category')->name('product.category');
    //显示商品列表
    Route::get('/', 'ProductController@index');
    //显示商品详情
    Route::get('show', 'ProductController@show')->name('product.show');
});

//购物车管理
Route::group(['prefix' => 'cart'], function () {
    Route::get('/', 'CartController@index');
    Route::post('/', 'CartController@store');
    Route::delete('/', 'CartController@destroy');
    Route::patch('/', 'CartController@change_num');
});

//订单管理
Route::group(['prefix' => 'order'], function () {
    //下单
    Route::get('check_out', 'OrderController@check_out')->name('order.check_out');
    //生成订单
    Route::post('store', 'OrderController@store')->name('order.store');
    //支付订单
    Route::get('show_pay/{id}', 'OrderController@show_pay')->name('order.show_pay');
    //订单列表
    Route::get('/', 'OrderController@index');
    //查看订单详情
    Route::get('show', 'OrderController@show')->name('order.show');
    //取消订单
    Route::delete('{id}', 'OrderController@destroy');
});

//地址管理
Route::group(['prefix' => 'address'], function () {
    //管理地址
    Route::get('manage', 'AddressController@manage')->name('address.manage');
    //设置默认地址
    Route::patch('default_address', 'AddressController@default_address')->name('address.default_address');
});
Route::resource('address', 'AddressController');


//服务管理
Route::group(['prefix' => 'customer'], function () {
    Route::get('/', 'CustomerController@index');
});


//抽奖管理
Route::group(['prefix' => 'draw'], function () {

    Route::get('/', 'DrawController@index');
    Route::post('store', 'DrawController@store');
});
